import requests


class TpshopRegister(object):

    # def setup(self):
    # session = requests. Session()
    def get_varify_code(self, session):
        session.get(url="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify&type=user_reg")

    def register(self, session, req_data):
        resp = session.post(url="http://hmshop-test.itheima.net/Home/User/reg.html",
                            data=req_data)
        print(resp.json())
        return resp


if __name__ == '__main__':
    test_reg = TpshopRegister()
    session = requests.Session()
    # ret1= test_reg.setup()
    ret2 = test_reg.get_varify_code(session)
    resp = test_reg.register(session, {"scene": "1",
                                       "username": "13089498921",
                                       "verify_code": "8888",
                                       "password": "519475228fe35ad067744465c42a19b2",
                                       "password2": "519475228fe35ad067744465c42a19b2"})
    print(resp.json())
